<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/include/page.jsp"%>
<c:set value="${requestScope.response.data.pageInfoUtil }" var="pageInfoUtil"/>
<c:set value="${requestScope.response.data.list }" var="list"/>
<!DOCTYPE html>
<html lang="en">
	<head>
		<title>博客列表 - 美妆产品销售系统</title>
		<%@ include file="/common/include/head_title.jsp"%>
	</head>
	<body>
		<jsp:include page="/IndexHeadServlet">
			<jsp:param value="header" name="method"/>
		</jsp:include>
		<section class="page-content-wrapper login-area ptb-100">
			<div class="container">
				<div class="row">
					<div class="col-md-12 col-sm-12 col-xs-12">
						<h2 class="sub-header">博客列表</h2>
						<form action="${rootPath }/IndexHeadServlet?method=blogList" method="post" class="form-inline">
							<label for="keyword">关键字:</label>
							<input type="text" name="keyword" value="${requestScope.keyword }" class="form-control mr-sm-2">
							查询类型
							<select name="operType" class="form-control mr-sm-2">
								<option value="">查询全部</option>
								<option value="self" ${requestScope.operType == 'self' ? 'selected': '' }>只查询自己</option>
							</select>
							<input type="submit" class="btn btn-primary form-control mr-sm-2" value="搜索">
							<a href="${rootPath }/head/UsersHeadServlet?method=blogInsert" target="_blank" class="btn btn-success">添加</a>
						</form>
					</div>
					
				   <div class="col-md-12 col-sm-12 col-xs-12">
						<div class="table-content table-responsive">
							<table>
								<thead>
									<tr>
										<th>序号</th>
										<th>用户</th>
										<th>名称</th>
										<th>顶</th>
										<th>踩</th>
										<th>时间</th>
										<th>操作</th>
									</tr>
								</thead>
								<tbody>
									<c:forEach items="${list }" var="listTemp" varStatus="stat">
										<tr>
											<td>${stat.count }</td>
											<td>${listTemp.users.nick}</td>
											<td title="${listTemp.name }">
												<a href="${rootPath }/IndexHeadServlet?method=blogUpdate&id=${listTemp.id}" target="_blank">
													${fn:substring(listTemp.name,0,subStrLen) }
												</a>
											</td>
											<td>${listTemp.upNum}</td>
											<td>${listTemp.downNum }</td>
											<td>${listTemp.createTime }</td>
											<td>
												<c:if test="${sessionScope.users.id == listTemp.usersId }">
													<a href="${rootPath }/IndexHeadServlet?method=blogUpdate&operType=update&id=${listTemp.id}" target="_blank">修改</a>
												</c:if>
											</td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
						</div>
					</div>
					
					<div class="col-">
						<form id="pageForm" action="${rootPath }/IndexHeadServlet?method=blogList"
							method="post" class="form-inline">
							<!-- 设置一些参数 -->
							<input type="hidden" name="keyword" value="${requestScope.keyword }">
							<input type="hidden" name="status" value="${requestScope.status }">
							<input type="hidden" name="st" value="${requestScope.st }">
							<input type="hidden" name="ed" value="${requestScope.ed }">
							
							<input type="hidden" name="operType" value="${requestScope.operType }">
		
							<nav aria-label="Page navigation example">
								<ul class="pagination justify-content-end">
									<li class="page-item">
										<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '1', 'pageSize','${pageInfoUtil.pageSize}')">
											<span>首页</span>
										</a>
									</li>
									<li class="page-item">
										<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.prePage}', 'pageSize','${pageInfoUtil.pageSize}')">
											<span>上一页</span>
										</a>
									</li>
									<li class="page-item">
										<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.nextPage}', 'pageSize','${pageInfoUtil.pageSize}')">
											<span>下一页</span>
										</a>
									</li>
									<li class="page-item">
										<a href="#" class="page-link" onclick="return pageFormSubmit('pageForm', 'currentPage', '${pageInfoUtil.totalPage}', 'pageSize','${pageInfoUtil.pageSize}')">
											<span>尾页</span>
										</a>
									</li>
									<li class="page-item">共${pageInfoUtil.totalRecord }条,共${pageInfoUtil.totalPage}页</li>
									<li class="page-item">
										第<input type="text" id="currentPage" name="currentPage" class="form-control" value="${pageInfoUtil.currentPage }"  size="5" maxlength="5"/>页
									</li>
									<li class="page-item">
										<input type="text" id="pageSize" name="pageSize" class="form-control" value="${pageInfoUtil.pageSize }" size="5" maxlength="5"/>
									</li>
									<li class="page-item"><input type="submit" value="GO" class="form-control btn btn-primary"/></li>
								</ul>
							</nav>
						</form>
					</div>
				</div>
			</div>
		</section>
		<%@ include file="/common/include/head_footer.jsp"%>
	</body>
</html>